﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using PermissionDesign.Model;
using PermissionDesign.Service;
using PermissionDesign.Tool;

namespace PermissionDesign.Web.Controllers
{
    public class AdministrativeController : Controller
    {
        private RoleService _roleService;
        public AdministrativeController(RoleService roleService)
        {
            _roleService = roleService;
        }

        public IActionResult Index()
        {
            //角色ID
            int roleId = int.Parse(CookieHelper.SingleTon().GetCookieValue(EnumHelper.SingleTon().GetEnumDescription(EnumConfig.LoginingRoleIdKey), Request));
            //当前角色的拥有的功能编码
            ViewData["AuthorizeActions"] = _roleService.GetActionByRoleId(roleId);
            return View();
        }
    }
}